import request from '@/utils/request'
import {AddRequest, ListRequest, RemoveRequest} from '@/interface/products'

export const ProductListR = (req: ListRequest) => {
  return request({
    method: 'GET',
    url: '/product',
    params: req,
  })
}

//全部数据
export const ProductAllR = (req: ListRequest) => {
  return request({
    method: 'GET',
    url: '/product/all',
    params: req,
  })
}

//添加原材料
export const ProductAddR = (req: AddRequest) => {
  return request({
    method: 'POST',
    url: '/product',
    data: JSON.stringify(req),
  })
}

//删除原材料
export const ProductRemoveR = (req:RemoveRequest) => {
  return request({
    method: 'DELETE',
    url: `/product`,
    params: req
  })
}


//修改原材料
export const ProductUpdateR = (req: AddRequest) => {
  console.log('修改原材料表单:', req)
  return request({
    method: 'PUT',
    url: '/product',
    // data: data,
    data: JSON.stringify(req),
  })
}